package com.qtt.app.mapper;

import com.qtt.app.entity.GeneralCourse;
import com.qtt.app.entity.ReturnInfo.ReturnResearch;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GeneralCourseMapper {
    int deleteByPrimaryKey(String id);

    int insert(GeneralCourse record);

    int insertSelective(GeneralCourse record);

    GeneralCourse selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(GeneralCourse record);

    int updateByPrimaryKeyWithBLOBs(GeneralCourse record);

    int updateByPrimaryKey(GeneralCourse record);

    List<GeneralCourse> getAll();

    List<GeneralCourse> getCourseByTeacherId(@Param("teacherId") Integer teacherId);

    @Select("SELECT * FROM general_course ORDER BY id DESC LIMIT 1")
    GeneralCourse getLastEntity();//查找最后添加的id，用于添加数据后返回id

    @Select("SELECT * FROM general_course WHERE title=#{title}")
    GeneralCourse getGeneralCourseByTitle(@Param("title") String title);

//    @Select("SELECT * FROM general_course WHERE title like #{keyword}")
    List<ReturnResearch> searchCourse(@Param("keyword") String keyword);
}